import request from "@/utils/request";

// 获取仓库列表
export function getWarehouseList(params) {
  return request({
    url: "/warehouse/list",
    method: "get",
    params,
  });
}

// 获取仓库详情
export function getWarehouseDetail(id) {
  return request({
    url: `/warehouse/${id}`,
    method: "get",
  });
}

// 添加仓库
export function addWarehouse(data) {
  return request({
    url: "/warehouse",
    method: "post",
    data,
  });
}

// 更新仓库信息
export function updateWarehouse(data) {
  return request({
    url: `/warehouse`,
    method: "put",
    data,
  });
}

// 删除仓库
export function deleteWarehouse(id) {
  return request({
    url: `/warehouse/${id}`,
    method: "delete",
  });
}

// 获取仓库库存
export function getWarehouseStock(warehouseId) {
  return request({
    url: `/warehouse/${warehouseId}/stock`,
    method: "get",
  });
}

// 获取库存变动记录
export function getStockRecords(params) {
  return request({
    url: `/warehouse-stock-record/warehouse/${params.warehouseId}`,
    method: "get",
  });
}
